Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@pinecone-database/pinecone

Package Overview
Dependencies
Maintainers
1
Versions
695
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@pinecone-database/pinecone

This is the official Node.js SDK for [Pinecone](https://www.pinecone.io), written in TypeScript.

  • 3.0.3
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
194K
increased by15.12%
Maintainers
1
Weekly downloads
 
Created

What is @pinecone-database/pinecone?

@pinecone-database/pinecone is an npm package that provides a client for interacting with the Pinecone vector database. Pinecone is designed for high-performance vector similarity search, making it useful for applications like recommendation systems, semantic search, and machine learning model deployment.

What are @pinecone-database/pinecone's main functionalities?

Initialize Pinecone Client

This code initializes the Pinecone client with the provided API key and environment. Initialization is the first step to interact with the Pinecone database.

const { PineconeClient } = require('@pinecone-database/pinecone');
const client = new PineconeClient();
client.init({ apiKey: 'your-api-key', environment: 'us-west1-gcp' });

Create Index

This code demonstrates how to create a new index in Pinecone. An index is a collection of vectors that you can query against.

const createIndex = async () => {
  await client.createIndex({
    name: 'example-index',
    dimension: 128
  });
};
createIndex();

Insert Vectors

This code inserts vectors into an existing index. Each vector has an ID and a list of values representing its coordinates in the vector space.

const insertVectors = async () => {
  await client.upsert({
    indexName: 'example-index',
    vectors: [
      { id: 'vec1', values: [0.1, 0.2, 0.3] },
      { id: 'vec2', values: [0.4, 0.5, 0.6] }
    ]
  });
};
insertVectors();

Query Vectors

This code queries the index for the top K most similar vectors to the provided query vector. The result contains the IDs and similarity scores of the closest vectors.

const queryVectors = async () => {
  const result = await client.query({
    indexName: 'example-index',
    topK: 2,
    vector: [0.1, 0.2, 0.3]
  });
  console.log(result);
};
queryVectors();

Delete Index

This code deletes an existing index from Pinecone. This is useful for cleanup or when the index is no longer needed.

const deleteIndex = async () => {
  await client.deleteIndex({
    name: 'example-index'
  });
};
deleteIndex();

Other packages similar to @pinecone-database/pinecone

FAQs

Package last updated on 11 Sep 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc